#ifndef MYSCENE_H
#define MYSCENE_H

namespace Esri::ArcGISRuntime {
class SceneGraphicsView;
class GraphicsOverlay;
class ShapefileFeatureTable;
class Scene;
class FeatureLayer;
class PolygonBuilder;
class SimpleFillSymbol;
class Camera;
}

#include <QMainWindow>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QFuture>
#include <QPointF>
#include <QCheckBox>
#include <QPushButton>
#include <QLabel>
#include <QFileDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QUrl>
#include <QDir>
#include <QDirIterator>
#include <QImage>
#include <QScrollArea>
#include <QEvent>
#include <QtConcurrent>
#include <QLineEdit>

#include <gdal_priv.h>
#include <ogrsf_frmts.h>

#include <switchbt.h>
#include <flabel.h>

#include <ArcGISIncludeCompatibility.h>
#include <ElevationSourceListModel.h>
#include <MapTypes.h>
#include <Scene.h>
#include <SceneGraphicsView.h>
#include <Surface.h>
#include <Scene.h>

#include <LayerListModel.h>

#include <Camera.h>
#include <Viewpoint.h>

#include <ShapefileFeatureTable.h>
#include <FeatureLayer.h>
#include <SimpleFillSymbol.h>
#include <SymbolTypes.h>
#include <SimpleMarkerSymbol.h>
#include <SimpleLineSymbol.h>
#include <SimpleRenderer.h>

#include <IdentifyLayerResult.h>
#include <GeoView.h>
#include <GeoModel.h>

#include <Basemap.h>

#include <IdentifyLayerResult.h>

#include <PolygonBuilder.h>
#include <PolylineBuilder.h>
#include <SpatialReference.h>
#include <Polygon.h>

#include <Graphic.h>
#include <GraphicListModel.h>
#include <GraphicsOverlay.h>
#include <GraphicsOverlayListModel.h>

#include <IdentifyGraphicsOverlayResult.h>
#include <AttributeListModel.h>

#include <PictureMarkerSymbol.h>
#include <PictureMarkerSymbolLayer.h>

#include <GeometryEngine.h>

#include <ErrorException.h>

class MyScene : public QMainWindow
{
    Q_OBJECT
public:
    explicit MyScene(QWidget* parent = nullptr);
    ~MyScene() override;

    QList<QPolygonF> geoByFile;          //添加的polygon
    QList<QString> fieldInfo;            //字段名称列表

    QPoint *msclpt;
    SwitchBt *fb1;
    SwitchBt *fb2;
    FLabel *flb1;
    FLabel *flb2;
    QImage *fimg;

    int wdWidth = 800;
    int wdHeigth = 600;

    int pw;
    int ph;

    QLineEdit *jd;
    QLineEdit *wd;

private:
    Esri::ArcGISRuntime::SceneGraphicsView*     m_sceneView = nullptr;
    Esri::ArcGISRuntime::Scene* m_scene=nullptr;
    Esri::ArcGISRuntime::GraphicsOverlay *m_viewPointLay=nullptr;
    Esri::ArcGISRuntime::GraphicsOverlay *m_picIcnLay=nullptr;
    Esri::ArcGISRuntime::GraphicsOverlay *m_picIcnLayByClick=nullptr;
    Esri::ArcGISRuntime::GraphicsOverlay *m_picFrameLay=nullptr;
    Esri::ArcGISRuntime::GraphicsOverlay *m_shapeFileLay=nullptr;
    Esri::ArcGISRuntime::Graphic* fClickPhoto=nullptr;
    Esri::ArcGISRuntime::Graphic* tp1=nullptr;

    Esri::ArcGISRuntime::PolygonBuilder* polygonBuilder;
    Esri::ArcGISRuntime::PolylineBuilder* polylineBuilder;

    Esri::ArcGISRuntime::SimpleFillSymbol* polygonSymbol;
    //平面点符号
    Esri::ArcGISRuntime::SimpleMarkerSymbol* simpleMarkerSymbol;
    //平面线符号
    Esri::ArcGISRuntime::SimpleLineSymbol* simpleLineSymbol;

    Esri::ArcGISRuntime::SimpleMarkerSceneSymbol* fPointSymbol;
    Esri::ArcGISRuntime::Camera *sceneCamera;

    void showRaster();
    void showOSM();
    void createShapeFeature();
    void hideShapeBtn();
    void addPicDir();
    void functionTest();
    void initCam();
    void creatPicPoint(QString picPath);
    void creatViewPoint(double x,double y);
    bool checkPicInfo(QString picPath);
    void creatPhotoFrame(QString picPath);
    void creatFLabelPhoto(QString picPath);
    void creatPicInfoIcon(double x,double y,QString picPath);
    void clearViewPoint();

    QScrollArea *picScrollArea;
    bool btnOp = false;
    void addPicToScrollArea(QString picPath,QImage img);
    QVBoxLayout *swct1;

    void clearWidget();

    QList<double> picGPS(QString picPath);
    QString picDateTime(QString picPath);

    QTransform *picRot;

protected:
    void wheelEvent(QWheelEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    bool eventFilter(QObject *obj,QEvent *event) override;
};

#endif // MYSCENE_H
